/* Custom Animations for Todo List App */

/* Task item animations */
@keyframes slideOutLeft {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(-100%);
    opacity: 0;
  }
}

@keyframes completeTask {
  from {
    opacity: 1;
  }
  to {
    opacity: 0.5;
  }
}

@keyframes bounceIn {
  from,
  20%,
  40%,
  60%,
  80%,
  to {
    animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
  }

  0% {
    opacity: 0;
    transform: scale3d(0.3, 0.3, 0.3);
  }

  20% {
    transform: scale3d(1.1, 1.1, 1.1);
  }

  40% {
    transform: scale3d(0.9, 0.9, 0.9);
  }

  60% {
    opacity: 1;
    transform: scale3d(1.03, 1.03, 1.03);
  }

  80% {
    transform: scale3d(0.97, 0.97, 0.97);
  }

  to {
    opacity: 1;
    transform: scale3d(1, 1, 1);
  }
}

@keyframes fadeInOut {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Particle animation for empty state */
@keyframes float {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
  100% {
    transform: translateY(0px);
  }
}

@keyframes particleAnimation {
  0% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translate(var(--tx), var(--ty)) rotate(360deg);
    opacity: 0;
  }
}

/* Input focus animation */
@keyframes borderGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5);
  }
  70% {
    box-shadow: 0 0 0 5px rgba(59, 130, 246, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
  }
}

/* Button hover animation */
@keyframes fillSlide {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: 0 0;
  }
}

/* Progress bar animation */
@keyframes progressBarFill {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

/* Apply animations to classes */
.animate-slide-out {
  animation: slideOutLeft 0.5s ease forwards;
}

.animate-complete {
  animation: completeTask 0.3s ease forwards, progressBarFill 0.3s ease forwards;
}

.animate-bounce-in {
  animation: bounceIn 0.75s both;
}

.animate-fade-in-out {
  animation: fadeInOut 0.3s ease-in-out;
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-particle {
  animation: particleAnimation var(--duration, 5s) linear infinite;
}

.animate-border-glow {
  animation: borderGlow 1s infinite;
}

.animate-fill-slide {
  animation: fillSlide 0.3s ease;
}

.progress-bar {
  transition: width 0.3s ease;
}

/* For task completion line-through effect */
.completed-task {
  position: relative;
}

.completed-task::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background-color: currentColor;
  animation: progressBarFill 0.3s ease forwards;
  transform: scaleX(0);
  transform-origin: left;
}

.completed-task.completed::after {
  transform: scaleX(1);
}

/* Button hover effect with fill slide */
.btn-slide-hover {
  background-image: linear-gradient(90deg, transparent 50%, white 50%);
  background-size: 200% 100%;
  background-position: 100% 0;
  transition: background-position 0.3s ease;
}

.btn-slide-hover:hover {
  background-position: 0 0;
}

/* Icon scale effect */
.icon-scale-hover {
  transition: transform 0.2s ease;
}

.icon-scale-hover:hover {
  transform: scale(1.2);
}

/* Task item smooth positioning for drag and drop */
.task-item-smooth {
  transition: transform 0.3s ease;
}